package com.aaa.controller.sas;

import com.aaa.entity.LayData;
import com.aaa.entity.MyPage;
import com.aaa.entity.sas.TSasRecord;
import com.aaa.entity.sas.TjMessage;
import com.aaa.service.sas.TSasRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.common.Mapper;

@RestController
@RequestMapping("tSasRecord")
public class TSasRecordController {
    @Autowired
    private TSasRecordService tSasRecordService;

    /**
     * 查询所以的做题纪录
     * @param
     * @return
     */
    @GetMapping
    public LayData getData(MyPage myPage,TSasRecord tSasRecord){
        return new LayData(tSasRecordService.getAll(myPage,tSasRecord));
    }
    @GetMapping("checkRecord")

    public LayData checkUser(TSasRecord record){
        return  new LayData(tSasRecordService.checkrecord(record));
    }

    @PostMapping("addRecord")
    public LayData addrecord(TSasRecord record){
        return new LayData(tSasRecordService.insertRecord(record));
    }
    @GetMapping("{id}")
    public LayData getDetailData(@PathVariable Integer id, MyPage myPage){
        return new LayData(tSasRecordService.getDetailMsg(myPage,id));
      }
    @GetMapping("tj")
    public LayData getTongji(){
        return new LayData(tSasRecordService.getTjData());
    }

    @GetMapping("tj2")
    public LayData getTongji2(MyPage myPage, TjMessage tjMessage){
        return new LayData(tSasRecordService.getTjData2(myPage,tjMessage));
    }

}
